Skip to content

Implement URI for pure Wasm#2

Open
lostflydev wants to merge 1 commit intoscala-wasmfrom
fix/151-uri-normalize-wasm
Open

Implement URI for pure Wasm#2
lostflydev wants to merge 1 commit intoscala-wasmfrom
fix/151-uri-normalize-wasm

Conversation

@lostflydev
Copy link
Owner

@lostflydev lostflydev commented Mar 9, 2026

Summary

Make java.net.URI fully compatible with the pure Wasm backend by providing linkTimeIf branches for all JS-dependent operations.

Closes scala-wasm#153

Changes

  • URI parsing: new parseURI() abstraction returns Array[String] instead of js.RegExp.ExecResult; uses java.util.regex.Pattern on Wasm
  • normalize(): separate normalizeJS() (js.Array with mutating ops) and normalizePureWasm() (Scala Array + System.arraycopy + StringBuilder)
  • IPv6 detection: testIPv6() uses java.util.regex on Wasm
  • Quoting functions (userInfo, path, authority, illegal, nonASCII): extract regex strings into *ReStr vals; new quoteWithPattern() and quoteStrFn() for Wasm using java.util.regex + UTF-8 percent-encoding
  • Build.scala: enable URITest and ClassValueTest in Wasm test suite filter
  • Tests: 6 new tests for constructor quoting, IPv6 hosts, normalize edge cases, relative paths with colons, toString round-trips, and non-ASCII percent-encoding

@lostflydev lostflydev force-pushed the fix/151-uri-normalize-wasm branch 2 times, most recently from 6f7a29d to 915b509 Compare March 10, 2026 14:26
Use RegExpImpl abstraction instead of direct linkTimeIf branches:
- Add compile(patternStr, flags) overload to RegExpImpl
- Refactor parseURI, testIPv6, and all 5 quoting functions to use RegExpImpl
- Unify normalize() using String#split instead of jsSplit/js.Array
- Remove all JS-specific imports from URI.scala

Unblock URITest in pure Wasm test suite. Add tests for multi-component
constructor quoting, IPv6 detection, dot-only path normalization, and
empty segment normalization.
@lostflydev lostflydev force-pushed the fix/151-uri-normalize-wasm branch from 915b509 to 3ed6ea4 Compare March 15, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support fixed length list type in Component Model

1 participant